# --- Location of QDD/BDD package installation
QDDLOC = ..

# --- object list
OBJ = qdd.o support.o

# --- Location of QDD/BDD package header
INCDIR = $(QDDLOC)/include

# --- Location of QDD/BDD library
LIBDIR = $(QDDLOC)/lib

# --- Compiler flags
CFLAGS = -g -O3 -Wall

# --- C++ compiler
CPP = g++

# --- Linker flags for use with QDD
QDDFLAGS = -lqdd -lbdd -lm -lg++ -lgmp

all: libqdd.a phase

libqdd.a: $(OBJ)
	ar r libqdd.a $(OBJ)
	ranlib libqdd.a

phase.o: phase.cc
	$(CPP) -c phase.cc -I$(INCDIR) -o phase.o

LINK_CMD = g++ phase.o -L$(LIBDIR) $(QDDFLAGS) -o phase

phase: phase.o
	libtool --mode=link $(LINK_CMD)


qdd.o: qdd.cc
	$(CPP) $(CFLAGS) -c qdd.cc -I$(INCDIR) -o qdd.o

support.o: support.cc
	$(CPP) $(CFLAGS) -c support.cc -I$(INCDIR) -o support.o

install:
	cp -f libqdd.a $(LIBDIR)/.
	chmod 644 $(LIBDIR)/libqdd.a
	cp -f qdd.h $(INCDIR)/.
	chmod 644 $(INCDIR)/qdd.h

clean:
	rm -rf $(OBJ) libqdd.a
